//
//  ViewController.m
//  ZBExtensionKit
//
//  Created by apple on 2018/8/10.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "ViewController.h"
#import "Animal.h"
#import "NSObject+ZBModel.h"
#import "ZBJSONKit.h"
#import "NSObject+ZBProperty.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
   
}


//字典转模型
- (void)dictToModel
{
    NSDictionary *dict = @{
                           @"name":@"dd",
                           @"age":@(12),
                           @"sex":@(YES),
                           @"dog":[self dogDict],
                           @"dogs":@[[self dogDict],[self dogDict]],
                           };
    Animal  *animal  =  [Animal zb_objectWithDictionary:dict];
    
    //模型转字典
   NSDictionary *keyValue =  animal.zb_keyValues;
    
    NSString *attributeType =  [Animal zb_getPropertyTypeWithPropertyName:@"age"];
    
    NSArray *attributeKey = [Animal zb_getPropertyListWithonlyKey:NO];
    
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    [self dictToModel];
}

- (NSDictionary *)dogDict
{
    return @{
          @"name":@"狗狗",
          @"age":@(100),
          };
}

@end
